package com.meida.module.bus.provider.api.util;

import com.meida.module.bus.client.entity.BusOaApiExpLog;
import com.meida.module.bus.client.entity.BusOaApiLog;
import com.meida.module.bus.client.entity.BusSrmApiExpLog;
import com.meida.module.bus.client.entity.BusSrmApiLog;
import com.meida.module.bus.provider.service.BusOaApiExpLogService;
import com.meida.module.bus.provider.service.BusOaApiLogService;
import com.meida.module.bus.provider.service.BusSrmApiExpLogService;
import com.meida.module.bus.provider.service.BusSrmApiLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class PmsLogUtil {
    @Autowired
    private BusOaApiLogService busOaApiLogService;
    @Autowired
    private BusOaApiExpLogService busOaApiExpLogService;
    @Autowired
    private BusSrmApiLogService busSrmApiLogService;
    @Autowired
    private BusSrmApiExpLogService busSrmApiExpLogService;

    // PMS-OA交互正常日志
    public void saveBusOaApiLog(BusOaApiLog busOaApiLog) {
        busOaApiLogService.save(busOaApiLog);
    }

    // PMS-OA交互异常日志
    public void saveBusOaApiExpLog(String exceptionNm, String content) {
        BusOaApiExpLog busOaApiExpLog = new BusOaApiExpLog();
        busOaApiExpLog.setExceptionNm(exceptionNm);
        busOaApiExpLog.setContent(content);
        busOaApiExpLogService.save(busOaApiExpLog);
    }

    // PMS-SRM交互正常日志
    public void saveBusSrmApiLog(String model, String req) {
        BusSrmApiLog busSrmApiLog = new BusSrmApiLog();
        busSrmApiLog.setModel(model);
        busSrmApiLog.setReq(req);
        busSrmApiLogService.save(busSrmApiLog);
    }

    // PMS-SRM交互异常日志
    public void saveBusSrmApiExpLog(String exceptionNm, String content) {
        BusSrmApiExpLog busSrmApiExpLog = new BusSrmApiExpLog();
        busSrmApiExpLog.setExceptionNm(exceptionNm);
        busSrmApiExpLog.setContent(content);
        busSrmApiExpLogService.save(busSrmApiExpLog);
    }

    public void saveBusSrmApiExpLog(String exceptionNm, String content, String createDate) {
        BusSrmApiExpLog busSrmApiExpLog = new BusSrmApiExpLog();
        busSrmApiExpLog.setExceptionNm(exceptionNm);
        busSrmApiExpLog.setContent(content);
        busSrmApiExpLogService.save(busSrmApiExpLog);
    }
}
